package cn.mong.util.modelexcel;

import java.util.List;

import lombok.Data;

/**
 * excel格子的表头模型.
 * @author mengxianming@2021-8-19 17:39:11
 *
 */
@Data
public class HeaderCell implements BaseCell, Cloneable{
    private int id; // 唯一标识
    private int col;   // 从0开始
    private int width; // 字符宽度
    private int xspan; // 从1开始
    private int yspan; // 从1开始
    private Object val;

    private int index; // 从1开始

    private Class<?> modelClazz;
    private List<String> propertyNames;
    private Class<?> subModelClazz;

    private List<HeaderCell> subHeaders;
    private CellStyleCustomizer headerCellStyleCustomizer;
    private CellStyleCustomizer valueCellStyleCustomizer;
    @SuppressWarnings("rawtypes")
    private ModelToCellsConverter modelToCellsConverter;
    private boolean modelToCellsHorizontal;

    public boolean hasSub() {
        return subHeaders != null && !subHeaders.isEmpty();
    }


    public String getPropertyName() {
        return propertyNames.get(propertyNames.size() - 1);
    }
}